package com.example.yls.demoa;

import android.os.Binder;
import android.util.Log;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by yls on 2018/12/17.
 */

public class MyBinder extends Binder {


    public int add(int a, int b){
        return  a + b;
    }


    public void send(final String msg, final IMyInterface iMyInterface){
        Log.e("MyBinder","收到消息");
        new Thread(){
            @Override
            public void run() {
                while (true){
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    iMyInterface.success(sdf.format(new Date()));
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();
    }

}
